import java.util.*;

public class FindBrotherWord {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        while(s.hasNext()) {
            String str = s.nextLine();
            String[] strs = str.split(" ");
            int n = Integer.parseInt(strs[0]);
            String[] strs1 = new String[n];
            for(int i = 0; i < n; i++) {
                strs1[i] = strs[i + 1];
            }
            String x = strs[n + 1];
            char[] chars = x.toCharArray();
            Set<Character> set = new HashSet<>();
            for(char c : chars) {
                set.add(c);
            }
            int k = Integer.parseInt(strs[n + 2]);
            List<String> res = new LinkedList<>();
            Set<String> stringHashSet = new HashSet<>();
            for(String st : strs1) {
                if(st.equals(x) || st.length() != x.length() || !numEq(st,x)) {
                    continue;
                }else {
                    if(isBro(st,set) && !stringHashSet.contains(st)) {
                        res.add(st);
                        stringHashSet.add(st);
                    }
                }
            }
            Collections.sort(res, new Comparator<String>() {
                @Override
                public int compare(String o1, String o2) {
                    return o1.compareTo(o2);
                }
            });
            System.out.println(res.size());
            System.out.println(res.get(k - 1));
        }
    }

    private static boolean numEq(String st, String x) {
        int sum = 0;
        for (int i = 0; i < x.length(); i++) {
            sum += (x.charAt(i) - st.charAt(i));
        }
        return sum == 0? true : false;
    }

    public static boolean isBro(String s,Set<Character> set) {
        char[] chars = s.toCharArray();
        for(char c : chars) {
            if(!set.contains(c)) {
                return false;
            }
        }
        return true;
    }
}
